package com.zhengke.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageInfo;
import com.zhengke.common.dao.CommonDao;
import com.zhengke.common.object.Result;
import com.zhengke.pojo.TjToday;
@Service
public class TjTodayServiceImpl implements TjTodayService {
	/**
     * ssx
     * */
	@Autowired
	private CommonDao dao;
	//查询
	@Override
	public Result queryTodays() throws Exception {
		List<TjToday> rtnList = (List<TjToday>) dao.findForList("TjTodayMapper.queryToday",null);
        PageInfo<TjToday> pageInfo = new PageInfo<TjToday>(rtnList);
		Result rs = new Result();
		rs.setCode("0");
		rs.setCount(pageInfo.getTotal());
        rs.setData(rtnList);		
		return rs;
	}
	
	//修改
	@Override
	public Result updateTodays(TjToday today) throws Exception {
		Map<String,Object> param = new HashMap<String,Object>();
		param.put("id", today.getId());
		param.put("title", today.getTitle());
		param.put("commodity",today.getCommodity());
		param.put("price", today.getPrice());
		param.put("company", today.getCompany());
		param.put("updateTime",today.getUpdateTime());
		dao.update("TjTodayMapper.updateToday", param);
		return null;
	}

}
